package com.wyl.demo01.controller

import org.springframework.stereotype.Controller
import org.springframework.ui.Model
import org.springframework.web.bind.annotation.GetMapping

//在/templates目录下的所有页面, 只能通过controller跳转
//这个需要模板引擎的支持! thymeleaf
@Controller
class TestController {

    @GetMapping("/test")
    fun test(model: Model): String {
        model.apply {
            addAttribute("msg", "快速入门")
            addAttribute("msg2", "<h1>from kotlin</h1>")
            addAttribute("users", listOf("xiaobai", "xiaohei", "糖果", "花卷"))
        }
        return "test"
    }
}